package com.example.xd.model_video;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;

import com.alibaba.android.arouter.facade.annotation.Route;
import com.alibaba.android.arouter.launcher.ARouter;
import com.example.xd.model_video.videoeditlib.AddFilterUtil;
import com.example.xd.model_video.videoeditlib.editVideoPlay.EditVideoPlayer;
import com.example.xd.model_video.videoeditlib.magicfiltertype.MagicFilterType;

/**
 * @author xd
 */

@Route(path = "/model_video/VideoActivity")
public class VideoActivity extends AppCompatActivity implements View.OnClickListener {

    private EditVideoPlayer mEdit_video_player;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.video_activity_main);
        mEdit_video_player = findViewById(R.id.edit_video_player);
        findViewById(R.id.btn0).setOnClickListener(this);
        findViewById(R.id.btn1).setOnClickListener(this);
        findViewById(R.id.btn2).setOnClickListener(this);
        findViewById(R.id.btn3).setOnClickListener(this);
        findViewById(R.id.btn4).setOnClickListener(this);
        findViewById(R.id.btn5).setOnClickListener(this);
        findViewById(R.id.btn6).setOnClickListener(this);
        findViewById(R.id.btn7).setOnClickListener(this);
        findViewById(R.id.btn8).setOnClickListener(this);
        findViewById(R.id.btn9).setOnClickListener(this);
        findViewById(R.id.btn10).setOnClickListener(this);
        findViewById(R.id.btn11).setOnClickListener(this);
        findViewById(R.id.btn12).setOnClickListener(this);
        findViewById(R.id.btn13).setOnClickListener(this);
        String url1 = "/storage/emulated/0/AzRecorderFree/2017_07_07_15_24_06.mp4";
        String url2 = "/storage/emulated/0/AzRecorderFree/2017_07_07_18_52_35.mp4";
        String url3 = "/storage/emulated/0/电影/1558593082556.mp4";
        String url5 = "/storage/emulated/0/DCIM/crop_1559011435029.mp4";
        String path = getIntent().getStringExtra("path");
        mEdit_video_player.setVideoPath(url5);
        findViewById(R.id.btn).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                ARouter.getInstance()
                        .build("/myapplication/MainActivity")
                        .navigation();
//                startActivity(new Intent(VideoActivity.this, VideoEditActivity.class));
            }
        });


    }

    @Override
    public void onClick(View v) {
        int i = v.getId();
        if (i == R.id.btn0) {
            AddFilterUtil.getInstance().addFilter(mEdit_video_player, MagicFilterType.NONE);
        } else if (i == R.id.btn1) {
            AddFilterUtil.getInstance().addFilter(mEdit_video_player, MagicFilterType.FILTER_1);
        } else if (i == R.id.btn2) {
            AddFilterUtil.getInstance().addFilter(mEdit_video_player, MagicFilterType.FILTER_2);
        } else if (i == R.id.btn3) {
            AddFilterUtil.getInstance().addFilter(mEdit_video_player, MagicFilterType.FILTER_3);
        } else if (i == R.id.btn4) {
            AddFilterUtil.getInstance().addFilter(mEdit_video_player, MagicFilterType.FILTER_4);
        } else if (i == R.id.btn5) {
            AddFilterUtil.getInstance().addFilter(mEdit_video_player, MagicFilterType.FILTER_5);
        } else if (i == R.id.btn6) {
            AddFilterUtil.getInstance().addFilter(mEdit_video_player, MagicFilterType.FILTER_6);
        } else if (i == R.id.btn7) {
            AddFilterUtil.getInstance().addFilter(mEdit_video_player, MagicFilterType.FILTER_7);
        } else if (i == R.id.btn8) {
            AddFilterUtil.getInstance().addFilter(mEdit_video_player, MagicFilterType.FILTER_8);
        } else if (i == R.id.btn9) {
            AddFilterUtil.getInstance().addFilter(mEdit_video_player, MagicFilterType.FILTER_9);
        } else if (i == R.id.btn10) {
            AddFilterUtil.getInstance().addFilter(mEdit_video_player, MagicFilterType.FILTER_10);
        } else if (i == R.id.btn11) {
            AddFilterUtil.getInstance().addFilter(mEdit_video_player, MagicFilterType.FILTER_11);
        } else if (i == R.id.btn12) {
            AddFilterUtil.getInstance().addFilter(mEdit_video_player, MagicFilterType.FILTER_12);
        } else if (i == R.id.btn13) {
            AddFilterUtil.getInstance().addFilter(mEdit_video_player, MagicFilterType.FILTER_13);
        }
    }
}
